package com.ego.e.utils

import android.content.Context
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.util.SparseArray
import android.view.View

/**
 * 
 * Created by lxy on 2017/5/21.
 */
object EUtils {

    @JvmStatic fun vertical(rec: RecyclerView) {
        setLinearLayoutManager(rec.context, rec, LinearLayoutManager.VERTICAL)
    }

    @JvmStatic fun vertical(context: Context, rec: RecyclerView) {
        setLinearLayoutManager(context, rec, LinearLayoutManager.VERTICAL)
    }

    @JvmStatic fun horizontal(rec: RecyclerView) {
        setLinearLayoutManager(rec.context, rec, LinearLayoutManager.HORIZONTAL)
    }

    @JvmStatic fun horizontal(context: Context, rec: RecyclerView) {
        setLinearLayoutManager(context, rec, LinearLayoutManager.HORIZONTAL)
    }

    @JvmStatic fun setLinearLayoutManager(context: Context, rec: RecyclerView, orientation: Int) {
        val manager = LinearLayoutManager(context)
        manager.orientation = orientation
        manager.isSmoothScrollbarEnabled = true
        rec.layoutManager = manager
    }
}